package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityHome;

@Name("statusScriptParmsHome")
public class StatusScriptParmsHome extends EntityHome<StatusScriptParms> {

	@In(create = true)
	StatusActionsScriptHome statusActionsScriptHome;

	public void setStatusScriptParmsStatusScriptParmsId(Integer id) {
		setId(id);
	}

	public Integer getStatusScriptParmsStatusScriptParmsId() {
		return (Integer) getId();
	}

	@Override
	protected StatusScriptParms createInstance() {
		StatusScriptParms statusScriptParms = new StatusScriptParms();
		return statusScriptParms;
	}

	public void load() {
		if (isIdDefined()) {
			wire();
		}
	}

	public void wire() {
		getInstance();
		StatusActionsScript statusActionsScript = statusActionsScriptHome
				.getDefinedInstance();
		if (statusActionsScript != null) {
			getInstance().setStatusActionsScript(statusActionsScript);
		}
	}

	public boolean isWired() {
		if (getInstance().getStatusActionsScript() == null)
			return false;
		return true;
	}

	public StatusScriptParms getDefinedInstance() {
		return isIdDefined() ? getInstance() : null;
	}

}
